package acm;

    import com.company.Main;

    import java.util.Scanner;

    public class llll123456 {
        public static void main(String[] args) {
            Main test = new Main();
            Scanner in = new Scanner(System.in);
            long n = in.nextLong();
            beishu(n);
        }

        public static void beishu(long n) {
            long result = 0;
            if(n <= 2)  //此时最多只能选择两个数，不符合题意
                return;
            if(n % 2 == 1) {
                result = n * (n - 1) * (n - 2);
            } else {
                if(n % 3 == 0)  //说明n和n - 3有最大公约数3
                    result = (n - 1) * (n - 2) * (n - 3);
                else
                    result = n * (n - 1) * (n - 3);
            }
            System.out.println(result);
            return;
        }
    }

